package practicedemo53;

import java.util.ArrayList;
import java.util.Scanner;

public class Test {

    public static void main(String[] args) {
        //1.创建集合
        ArrayList<Student> list = new ArrayList<>();
        //2.键盘录入学生的信息
        for (int i = 0; i < 3; i++) {
            Scanner sc = new Scanner(System.in);
            System.out.println("输入姓名");
            Student stu = new Student();
            stu.setName(sc.next());
            System.out.println("输入年龄");
            stu.setAge(sc.nextInt());
            list.add(stu);
        }
        for (int i = 0; i < list.size(); i++) {
            System.out.printf(list.get(i).getName()+'\t');
            System.out.println(list.get(i).getAge());
        }

    }
}
